<?
		include("dbconn.inc");
		include("dbfuc.inc");
		include("session.inc");		
		$adminuser=$_SESSION["adminuser"];
		$adminid=$_SESSION["adminid"];
		$admindb=$_SESSION["admindb"];
		
	if(session_is_registered("admindb") )
	{
		if(($adminuser!="") && (($adminid!="") || ($adminid!=0)))
		{	
	$sday=$HTTP_POST_VARS["sday"];
	$smonth=$HTTP_POST_VARS["smonth"];	
	$syear=$HTTP_POST_VARS["syear"];
	$eday=$HTTP_POST_VARS["eday"];	
	$emonth=$HTTP_POST_VARS["emonth"];
	$eyear=$HTTP_POST_VARS["eyear"];					
		
	///	String sdate=sday+"/"+smonth+"/"+syear;
	//	String edate=eday+"/"+emonth+"/"+eyear;
	//	String enddate=eday+"-"+emonth+"-"+eyear;
		$sdate=$syear."-".$smonth."-".$sday;
		$edate=$eyear."-".$emonth."-".$eday;
		$enddate=$eyear."-".$emonth."-".$eyear;	
	
		$sql="";$name="";$add1="";$add2="";$add3="";$C_FNAME="";$C_ADDR1="";
		$C_ADDR2="";$C_ADDR3="";$join="";$nameuser="";$PN_ID="";
		$phone="";$mobile="";$accnumber="";$cnt=0;

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
.style5 {color: #000000}
.style6 {color: #FF0000}
-->
</style>
</head>

<body>

 <table width="807" height="71" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#66CC66">
  <tr>
    <th height="25" colspan="6" bgcolor="#CCCCCC" scope="col"><span class="style5">Joining 
          List - 
    for the period <span class="style6"><? echo $sdate ?> to <? echo $enddate ?> </span></span></th>
   </tr>
  <tr>
    <th width="29" bgcolor="#CCCCCC" scope="col"><span class="style3">SlNo</span></th>
    <th width="131" height="25" bgcolor="#CCCCCC" scope="col"><span class="style3">Name</span></th>
    <th width="79" bgcolor="#CCCCCC" scope="col"><span class="style3">Username</span></th>
    <th width="194" bgcolor="#CCCCCC" scope="col"><span class="style3">Address</span></th>
    <th width="105" bgcolor="#CCCCCC" scope="col"><span class="style3">Date of joining </span></th>
    <th width="134" bgcolor="#CCCCCC" class="style3" scope="col">Phone</th>
   </tr>

 
<?
			$sql="select c_fname,c_username,d_join,C_ADDR1,C_ADDR2,C_ADDR3,C_TELE_NO,C_MOBILE from mlm_master ,mlm_address_dtl  where mlm_master.pn_id=mlm_address_dtl.n_id  and d_join between '$sdate' and '$edate' order by d_join";
			//echo $sql;
			$result=mysql_query($sql);
			$rownum=mysql_num_rows($result);
			while($rownum >0)
			{
				$rownum=$rownum-1;
				$cnt=$cnt+1;
				$name=mysql_result($result,$rownum,"C_FNAME");	
				$add1=mysql_result($result,$rownum,"C_ADDR1");
				$add2=mysql_result($result,$rownum,"C_ADDR2");
				$add3=mysql_result($result,$rownum,"C_ADDR3");
				$phone=mysql_result($result,$rownum,"C_TELE_NO");
				$mobile=mysql_result($result,$rownum,"C_MOBILE");
				$nameuser=mysql_result($result,$rownum,"C_USERNAME");
				$join=mysql_result($result,$rownum,"d_join");		

				if($phone=="")
				$phone="";

?>
		
 

  <tr>
    <td class="style3"><div align="center"><? echo $cnt ?></div></td>
    <td height="19" class="style3"><div align="center"><? echo $name ?></div></td>
    <td class="style3"><div align="center"><? echo $nameuser ?></div></td>
    <td class="style3"><div align="center"><? echo $add1 ?>, <? echo $add2 ?>, <? echo $add3 ?></div></td>
	<td class="style3"><div align="center"><? echo $join ?></div></td>
    <td class="style3"><div align="left">PH: <? echo $phone ?><br>
MOB: <? echo $mobile ?></div></td>
   </tr>
<?
 	}
?>
</table>
</body>
</html>
<?
	
	}
	}
	else
	{
		$errormsg="Your session is expeired. Please login again.";
		header("location: index.php?error=$errormsg");
	}
?>
	